package com.qf.fmall.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.fmall.user.entity.UserAddr;
import com.qf.fmall.user.mapper.UserAddrMapper;
import com.qf.fmall.user.service.IUserAddrService;
import com.qf.fmall.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author weijy
 * @since 2024-01-18
 */
@CrossOrigin
@RestController
@RequestMapping("/useraddr")
public class UserAddrController {

    @Autowired
    private IUserAddrService userAddrService;

    @RequestMapping("/list")
    public ResultVo getuserAddr(Integer userId) {

        List<UserAddr> userAddrList = userAddrService.list(new QueryWrapper<UserAddr>().eq("user_id", userId));

        return new ResultVo(10000, "success", userAddrList);
    }

}
